import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/home/index'

Vue.use(VueRouter)

const routes = [
  {
    path: '/home',
    name: 'home',
    component: Home
  },
  {
    path: '/movie',
    name: 'movie',
    component: () => import(/* webpackChunkName: "movie" */ '@/views/movie/index.vue')
  },
  {
    path: '/ticket',
    name: 'ticket',
    component: () => import(/* webpackChunkName: "ticket" */ '@/views/ticket/index.vue')
  },
  {
    path: '/cinema',
    name: 'cinema',
    component: () => import(/* webpackChunkName: "cinema" */ '@/views/cinema/index.vue')
  },
  {
    path: '/mine',
    name: 'mine',
    component: () => import(/* webpackChunkName: "mine" */ '@/views/mine/index.vue')
  },
  {
    path: '/city',
    name: 'city',
    component: () => import(/* webpackChunkName: "city" */ '@/views/home/city/index.vue')
  },

  // 任意的非法路由 全部重定向到home
  {
    path: '*',
    redirect: '/home'
  }
]

const router = new VueRouter({
  routes
})

export default router
